<html>
<head><meta charset="utf-8"><title>Using Datapond in Polonius · t-compiler/wg-polonius · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/index.html">t-compiler/wg-polonius</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Using.20Datapond.20in.20Polonius.html">Using Datapond in Polonius</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="205728152"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Using%20Datapond%20in%20Polonius/near/205728152" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vytautas Astrauskas [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Using.20Datapond.20in.20Polonius.html#205728152">(Aug 02 2020 at 13:45)</a>:</h4>
<p><span class="user-mention" data-user-id="116113">@lqd</span> Does it make sense to work on improving Datapond so that eventually Polonius could be rewritten in actual Datalog? Or are there any fundamental problems that would prevent this such as procedural macros not being supported in the Rust compiler?</p>



<a name="205729974"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Using%20Datapond%20in%20Polonius/near/205729974" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Using.20Datapond.20in.20Polonius.html#205729974">(Aug 02 2020 at 14:38)</a>:</h4>
<p>proc macros are used in the compiler (<code>rustc_macros</code>)</p>



<a name="205738687"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Using%20Datapond%20in%20Polonius/near/205738687" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Using.20Datapond.20in.20Polonius.html#205738687">(Aug 02 2020 at 18:38)</a>:</h4>
<p>it's an interesting question, but at the same time I'm not sure what you envision when saying "rewritten in actual datalog" ? like changing the engine to Soufflé or having the implementation looking like regular rules rather than the datafrog DSL ?</p>



<a name="205738816"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Using%20Datapond%20in%20Polonius/near/205738816" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Using.20Datapond.20in.20Polonius.html#205738816">(Aug 02 2020 at 18:42)</a>:</h4>
<p>assuming you mean the 2nd: on the one hand, yes. For example, I've wanted to evaluate Demand Transformation over our different rules and that would be evidently easier with datapond generating the rules. On the other hand, and this is why I've also avoided doing that, I'm not 100% sure about what to do to make the current rules/implementation scale to what we need it to.</p>



<a name="205738952"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Using%20Datapond%20in%20Polonius/near/205738952" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Using.20Datapond.20in.20Polonius.html#205738952">(Aug 02 2020 at 18:46)</a>:</h4>
<p>specifically, and this is my personal opinion only, I feel we cannot easily take advantage of the fact that we are doing dataflow over a CFG. The "specialized solution" vs "generic solution".</p>



<a name="205738979"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Using%20Datapond%20in%20Polonius/near/205738979" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Using.20Datapond.20in.20Polonius.html#205738979">(Aug 02 2020 at 18:47)</a>:</h4>
<p>there are things it does super well, and I think it's perfect for documentation, explanation, specification/validation, that is more like a reference implementation</p>



<a name="205739077"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Using%20Datapond%20in%20Polonius/near/205739077" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Using.20Datapond.20in.20Polonius.html#205739077">(Aug 02 2020 at 18:50)</a>:</h4>
<p>on the other hand, no engine is going to look at some of our rules and rewrite them as reachability queries over the condensation graph</p>



<a name="205739141"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Using%20Datapond%20in%20Polonius/near/205739141" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Using.20Datapond.20in.20Polonius.html#205739141">(Aug 02 2020 at 18:52)</a>:</h4>
<p>or optimize passing around some state because the graph is acyclic</p>



<a name="205739169"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Using%20Datapond%20in%20Polonius/near/205739169" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Using.20Datapond.20in.20Polonius.html#205739169">(Aug 02 2020 at 18:53)</a>:</h4>
<p>or prune the computation of a subgraph because it's dominated by a kill node</p>



<a name="205739282"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Using%20Datapond%20in%20Polonius/near/205739282" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Using.20Datapond.20in.20Polonius.html#205739282">(Aug 02 2020 at 18:56)</a>:</h4>
<p>so I have to do those by hand, and at this point I wonder if I should actually be doing the computation in a dataflow framework :)</p>



<a name="205741372"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Using%20Datapond%20in%20Polonius/near/205741372" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vytautas Astrauskas [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Using.20Datapond.20in.20Polonius.html#205741372">(Aug 02 2020 at 19:48)</a>:</h4>
<p><span class="user-mention silent" data-user-id="133247">bjorn3</span> <a href="#narrow/stream/186049-t-compiler.2Fwg-polonius/topic/Using.20Datapond.20in.20Polonius/near/205729974">said</a>:</p>
<blockquote>
<p>proc macros are used in the compiler (<code>rustc_macros</code>)</p>
</blockquote>
<p>Thanks! I knew that there was some work on that, but I did not know whether it was merged or not.</p>



<a name="205741454"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Using%20Datapond%20in%20Polonius/near/205741454" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vytautas Astrauskas [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Using.20Datapond.20in.20Polonius.html#205741454">(Aug 02 2020 at 19:50)</a>:</h4>
<blockquote>
<p>at the same time I'm not sure what you envision when saying "rewritten in actual datalog" ? </p>
</blockquote>
<p>The oversimplified, but hopefully more clear idea would be using a procedural macro <code>datapond!</code> that generates the necessary code from the datalog facts.</p>



<a name="205741542"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Using%20Datapond%20in%20Polonius/near/205741542" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Using.20Datapond.20in.20Polonius.html#205741542">(Aug 02 2020 at 19:53)</a>:</h4>
<p>right right like we talked about in Barcelona then</p>



<a name="205741545"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Using%20Datapond%20in%20Polonius/near/205741545" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vytautas Astrauskas [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Using.20Datapond.20in.20Polonius.html#205741545">(Aug 02 2020 at 19:53)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116113">lqd</span> <a href="#narrow/stream/186049-t-compiler.2Fwg-polonius/topic/Using.20Datapond.20in.20Polonius/near/205739282">said</a>:</p>
<blockquote>
<p>so I have to do those by hand, and at this point I wonder if I should actually be doing the computation in a dataflow framework :)</p>
</blockquote>
<p>If you did that in the dataflow framework, would it still use the same data representation (tuples of numbers)? I am asking because, at least in theory, one could mix Datalog with Rust code.</p>



<a name="205741588"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Using%20Datapond%20in%20Polonius/near/205741588" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vytautas Astrauskas [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Using.20Datapond.20in.20Polonius.html#205741588">(Aug 02 2020 at 19:54)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116113">lqd</span> <a href="#narrow/stream/186049-t-compiler.2Fwg-polonius/topic/Using.20Datapond.20in.20Polonius/near/205741542">said</a>:</p>
<blockquote>
<p>right right like we talked about in Barcelona then</p>
</blockquote>
<p>Exactly.</p>



<a name="205741816"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Using%20Datapond%20in%20Polonius/near/205741816" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Using.20Datapond.20in.20Polonius.html#205741816">(Aug 02 2020 at 20:00)</a>:</h4>
<p>(again this is just my opinion :) for dataflow-like computations I'd assume it could be similar, but rustc already has such a dataflow framework. What I also meant to say was that a lot of things already exist there, so some of what I'm saying could be less "redo some polonius things in a dataflow framework" than "use what rustc already does instead of redoing them in datalog"</p>



<a name="205741830"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Using%20Datapond%20in%20Polonius/near/205741830" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Using.20Datapond.20in.20Polonius.html#205741830">(Aug 02 2020 at 20:01)</a>:</h4>
<p>or using, say, dominators and postdominators features already present in MIR</p>



<a name="205741883"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Using%20Datapond%20in%20Polonius/near/205741883" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Using.20Datapond.20in.20Polonius.html#205741883">(Aug 02 2020 at 20:02)</a>:</h4>
<p>rustc doesn't have a Nuutila implementation so I've done one but it could easily be integrated into the existing SCC features in rustc_data_structures</p>



<a name="205742109"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Using%20Datapond%20in%20Polonius/near/205742109" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vytautas Astrauskas [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Using.20Datapond.20in.20Polonius.html#205742109">(Aug 02 2020 at 20:08)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116113">lqd</span> <a href="#narrow/stream/186049-t-compiler.2Fwg-polonius/topic/Using.20Datapond.20in.20Polonius/near/205741816">said</a>:</p>
<blockquote>
<p>(again this is just my opinion :) for dataflow-like computations I'd assume it could be similar, but rustc already has such a dataflow framework. What I also meant to say was that a lot of things already exist there, so some of what I'm saying could be less "redo some polonius things in a dataflow framework" than "use what rustc already does instead of redoing them in datalog"</p>
</blockquote>
<p>Makes sense. <span aria-label="smiling face" class="emoji emoji-263a" role="img" title="smiling face">:smiling_face:</span></p>



<a name="205742113"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Using%20Datapond%20in%20Polonius/near/205742113" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vytautas Astrauskas [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Using.20Datapond.20in.20Polonius.html#205742113">(Aug 02 2020 at 20:09)</a>:</h4>
<p>Thanks for explaining!</p>



<a name="205742174"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Using%20Datapond%20in%20Polonius/near/205742174" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Using.20Datapond.20in.20Polonius.html#205742174">(Aug 02 2020 at 20:11)</a>:</h4>
<p>we might talk about this for the next sprint (tomorrow until wednesday)</p>



<a name="205742243"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Using%20Datapond%20in%20Polonius/near/205742243" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Using.20Datapond.20in.20Polonius.html#205742243">(Aug 02 2020 at 20:13)</a>:</h4>
<p>and that question seems like it'd fit right in the discussion/planning/etc parts of it</p>



<a name="205792404"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Using%20Datapond%20in%20Polonius/near/205792404" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Using.20Datapond.20in.20Polonius.html#205792404">(Aug 03 2020 at 13:20)</a>:</h4>
<p>Yeah, I'm of two minds about this.</p>



<a name="205792446"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Using%20Datapond%20in%20Polonius/near/205792446" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Using.20Datapond.20in.20Polonius.html#205792446">(Aug 03 2020 at 13:21)</a>:</h4>
<p>I can imagine that <em>literally using</em> datalog is not going to be a win, but I'm not entirely convinced yet.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>